/**
  ******************************************************************************
  * @file    can_task.cpp
  * @author  
  * @version V1.0
  * @date    2017-xx-xx
  * @brief   
  ******************************************************************************
  * @attention
  *
  *
  ******************************************************************************
  */
	
#include	"can_task.h"
#include	"bsp_can.h"
#include	"global_variable.h"

void vTaskCAN( void * pvParameters )
{
	cCAN	can1(CAN1);
	CanRxMsg RxMessage;
	portBASE_TYPE xStatus;
	uint32_t	id;
	
	while(1)                                                  
	{		
		xStatus = xQueueReceive(xQueueCAN, &RxMessage, portMAX_DELAY);
		if(pdPASS == xStatus)
		{
			//TODO
			id = RxMessage.StdId;
			can1.SetID(id);
			can1.SendStdData(RxMessage.Data, 8);			
		}
//		vTaskDelay(100/portTICK_RATE_MS);
		taskYIELD();
	}	
}
